view.profile = new function () {
		
	this.init = function() {

		var params = {
				'owner_name' : owner.name
		};

		var html = Mustache.to_html(template.profile.body, params);
		
		$(document.body).append(html);
		
		gadgets.window.adjustHeight(400);
		
		controller.profile.listWishes();
	};

	this.renderWishes = function(data) {
		
		$("#profile-wishlist").hide();
		
		data.show_prev = data.page > 1;
		data.show_next = data.page < data.pages;
		
		var html = Mustache.to_html(template.profile.wishlist, data);
		
		$("#profile-wishlist").html(html);
		
        $("#profile-pager-next").bind('click', function(event) {
        	controller.profile.listWishes("next");
        });
        
        $("#profile-pager-prev").bind('click', function(event) {
        	
        	controller.profile.listWishes("prev");
        });
        
        $("a.link-wish-show").bind("click", function() {
        	var params = {"wish_id" : this.rel, "action" : "show"};
        	gadgets.views.requestNavigateTo("canvas", params);
        });
		
		$("#profile-wishlist").slideDown();
	};
}
